package com.example.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.example.dao.CommentsAdminDao;
import com.example.entity.PageResult;
import com.example.entity.QueryPageBean;
import com.example.pojo.Comments;
import com.example.pojo.GoodsCategory;
import com.example.service.CommentsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;

@Service(interfaceClass = CommentsService.class)
public class CommentsServiceImpl implements CommentsService {

    @Autowired
    private CommentsAdminDao commentsAdminDao;
    @Override
    public PageResult findpage(QueryPageBean queryPageBean) {
        Integer currentPage = queryPageBean.getCurrentPage();
        Integer pageSize = queryPageBean.getPageSize();
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<GoodsCategory> page = commentsAdminDao.findByCondition(queryString);
        return new PageResult(page.getTotal(),page.getResult());
    }

    @Override
    public void deleteById(Integer id) {
        commentsAdminDao.deleteById(id);
    }
}
